package com.example.newproject_overseas.model.entity

import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.lifecycle.ViewModel

class ChatViewModel: ViewModel() {
    // 可变状态用于保存聊天消息列表
//    var chatMessages = mutableStateOf(emptyList<ChatMessage>())
//        private set


    var chatMessages = mutableStateOf(listOf(
        ChatMessage("1", "莫再提", "https://lmg.jj20.com/up/allimg/4k/s/02/2109250006343S5-0-lp.jpg", "HelloHi thereHi thereHi thereHi thereHi thereHi thereHi thereHi thereHi thereHi thereHi there", "left", "10:00 AM"),
        ChatMessage("2", "莫再讲", "https://lmg.jj20.com/up/allimg/1113/062520105I8/200625105I8-6-1200.jpg", "Hi there", "Me", "10:05 AM")
    ))
        private set
    // 添加新的聊天消息
    fun addChatMessage(message: ChatMessage) {
        chatMessages.value = chatMessages.value + message
    }
}